package com.codeoss.framework.service.impl;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.codeoss.framework.response.FileResponse;
import com.codeoss.framework.service.IFileService;

@Service
public class FileService implements IFileService {
	@Value("${framework.base-path}")
	private String basePath;
	@Override
	public FileResponse download(String filename) throws IOException {
		// TODO Auto-generated method stub
		FileResponse fileResponse=new FileResponse();
		File file=new File(basePath+"/tempfile"+File.separator+filename);
		FileInputStream fis=new FileInputStream(file);
		fileResponse.setInputStream(fis);
		return fileResponse;
	}

}
